<?php
// Header 
$this->set('title_for_layout', __("Danh sách plugin", true));

$params = array(
	//'root'	=>	$this->params['named']['root']
);
if (isset($this->params['plugin'])) {
	$params['plugin'] = $this->params['plugin'];
} else {
	$params['plugin'] = null;
}
// Load Css

// Load Javascript

?>

<style>
.alias {
	font-style:italic;
}
.field_name {
	font-weight:bold;
}
</style>
<h2 class='page_heading'><?php __("Các plugin đã cài đặt")?></h2>
<?php echo $session->flash()?>
					
<!-- table -->
<div class="table">
	<table cellpadding="0" cellspacing="0" id='news_list'>
		<thead>
			<tr>
				<th width='20'><a><?php echo __("#"); ?></a></th>
				<th width='20'><input type="checkbox" id='checkbox-control' control='index'/></th>
				<th></th>
				
				<th width='110'><a><?php echo __("Chức năng"); ?></a></th>
			</tr>
		</thead>
		<tbody>
			<?php if(!$installedPlugins):?>
			<tr class="row1">
				<td colspan="8" align="center" style="font-weight:bold"><?php echo __("Chưa có dữ liệu.");?></td>
			</tr>
			<?php
			endif;
				$start = 0;
				$i=0;
				$class = 'altrow';
				foreach ($installedPlugins['Plugins'] as $plugin => $properties):
					$class = $class == "" ? "class='odd'" : "";
					$page_id = "id";
					$i++;
			?>
			<tr <?php echo $class?> page_id="<?php echo $page_id?>">
				<td class="center"><?php echo ($start + $i)?></td>
				<td class="center"><input type="checkbox" class='index' name='checkbox_index[]' value='<?php echo $page_id?>'/></td>
				<td>
					<b><?php echo $properties['name'];?></b><br/>
					<span class='description'><i><?php echo $properties['description']?></i></span>
				</td>
				
				<!-- #insert Các cột dữ liệu khác -->
				
				<!-- #insert Cột publish nếu có -->
				<!-- #insert Cột Priority nếu có -->
				
				<td class='actions'>
					<div class="functions">
						<div class="header"><h4><?php __("Chức năng");?></h4></div>
						<ul>
							<li><a href="<?php echo $html->url($params + array('controller'=>$this->params['controller'], 'action'=>'edit', $page_id))?>" class="edit"><?php __("Chỉnh sửa")?></a></li>
							<li><a href="<?php echo $html->url($params + array('controller'=>$this->params['controller'], 'action'=>'uninstall', $plugin))?>" class="delete delete_page" onclick="return confirm('<?php __("Bạn có thật sự muốn tháo gỡ plugin này?")?>')"><?php __("Tháo gỡ")?></a></li>
						</ul>
					</div>
				</td>
			</tr>
			<?php endforeach;?>
		</tbody>
	</table>
</div>
<!-- table.end -->

<h2 class='page_heading'><?php __("Các plugin chưa cài đặt")?></h2>
					
<!-- table -->
<div class="table">
	<table cellpadding="0" cellspacing="0" id='news_list'>
		<thead>
			<tr>
				<th width='20'><a><?php echo __("#"); ?></a></th>
				<th width='20'><input type="checkbox" id='checkbox-control' control='index'/></th>
				<th></th>
				
				<th width='110'><a><?php echo __("Chức năng"); ?></a></th>
			</tr>
		</thead>
		<tbody>
			<?php if(!$notInstalledPlugins):?>
			<tr class="row1">
				<td colspan="8" align="center" style="font-weight:bold"><?php echo __("Chưa có dữ liệu.");?></td>
			</tr>
			<?php
			endif;
				$start = 0;
				$i=0;
				$class = 'altrow';
				foreach ($notInstalledPlugins as $plugin => $properties):
					$class = $class == "" ? "class='odd'" : "";
					$page_id = "id";
					$i++;
			?>
			<tr <?php echo $class?> page_id="<?php echo $page_id?>">
				<td class="center"><?php echo ($start + $i)?></td>
				<td class="center"><input type="checkbox" class='index' name='checkbox_index[]' value='<?php echo $page_id?>'/></td>
				<td>
					<b><?php echo $properties['name'];?></b><br/>
					<span class='description'><i><?php echo $properties['description']?></i></span>
				</td>
				
				<!-- #insert Các cột dữ liệu khác -->
				
				<!-- #insert Cột publish nếu có -->
				<!-- #insert Cột Priority nếu có -->
				
				<td class='actions'>
					<div class="functions">
						<div class="header"><h4><?php __("Chức năng");?></h4></div>
						<ul>
							<li><a href="<?php echo $html->url($params + array('controller'=>$this->params['controller'], 'action'=>'install', $properties['directory']))?>" class="edit"><?php __("Cài đặt")?></a></li>
						</ul>
					</div>
				</td>
			</tr>
			<?php endforeach;?>
		</tbody>
	</table>
</div>
<!-- table.end -->
